﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DataControls.aspx.cs" Inherits="DataControls" MaintainScrollPositionOnPostback="true" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="gvProducts" runat="server" AutoGenerateColumns="false" DataKeyNames="ProductID"
            DataSourceID="SqlDataSource" AllowPaging="true" PageSize="5" AllowSorting="true"
            AutoGenerateDeleteButton="True" AutoGenerateEditButton="True" AutoGenerateSelectButton="true">
            <EditRowStyle BackColor="Gray" />
            <SelectedRowStyle BackColor="Blue" />
            <AlternatingRowStyle BackColor="Aquamarine" />
            <EmptyDataTemplate>
            <b>nothing found</b>
            </EmptyDataTemplate>
            <Columns>
                <asp:BoundField DataField="ProductID" HeaderText="Product Identifier" InsertVisible="False"
                    ReadOnly="True" SortExpression="ProductID" />
                <asp:BoundField DataField="ProductName" HeaderText="Product Name" SortExpression="ProductName" />
                <asp:BoundField DataField="UnitPrice" HeaderText="UnitPrice" SortExpression="UnitPrice" />
                <asp:BoundField DataField="UnitsInStock" HeaderText="UnitsInStock" SortExpression="UnitsInStock" />
                <asp:BoundField DataField="UnitsOnOrder" HeaderText="UnitsOnOrder" SortExpression="UnitsOnOrder" />
                <asp:CheckBoxField DataField="Discontinued" HeaderText="Discontinued" SortExpression="Discontinued" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            SelectCommand="SELECT TOP 10 [ProductID], [ProductName], [UnitPrice], [UnitsInStock], [UnitsOnOrder], [Discontinued] FROM [Products]"
            DeleteCommand="DELETE FROM Products WHERE (ProductID = @productId)" UpdateCommand="UPDATE Products SET ProductName = @productName, UnitPrice = @unitPrice WHERE (ProductID = @productid)">
        </asp:SqlDataSource>
        <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource"
            DataValueField="ProductID" DataTextField="ProductName">
        </asp:DropDownList>
        <asp:CheckBoxList ID="cblProucts" runat="server" DataSourceID="SqlDataSource" DataValueField="ProductID"
            DataTextField="ProductName">
        </asp:CheckBoxList>
        <asp:ListBox ID="lbProducsts" runat="server" DataSourceID="SqlDataSource" DataValueField="ProductID"
            DataTextField="ProductName" AutoPostBack="True" SelectionMode="Multiple"></asp:ListBox>
        <asp:Repeater ID="rpProducts" runat="server" DataSourceID="SqlDataSource">
            <HeaderTemplate>
                <table border="1">
                    <tr>
                        <th>
                            Product Name
                        </th>
                        <th>Product Id</th>
                    </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr>
                    <td>
                        <%# Eval("ProductName") %>
                    </td>
                    <td>  <%# Eval("ProductID") %></td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                </table>
            </FooterTemplate>
        </asp:Repeater>

       <asp:DetailsView ID="dvProducts" runat="server" AutoGenerateColumns="false" DataKeyNames="ProductID"
            DataSourceID="SqlDataSource" AllowPaging="true">
       <EditRowStyle BackColor="Gray" />
           
            <AlternatingRowStyle BackColor="Aquamarine" />
            <EmptyDataTemplate>
            <b>nothing found</b>
            </EmptyDataTemplate>
            <Fields>
                <asp:BoundField DataField="ProductID" HeaderText="Product Identifier" InsertVisible="False"
                    ReadOnly="True" SortExpression="ProductID" />
                <asp:BoundField DataField="ProductName" HeaderText="Product Name" SortExpression="ProductName" />
                <asp:BoundField DataField="UnitPrice" HeaderText="UnitPrice" SortExpression="UnitPrice" />
                <asp:BoundField DataField="UnitsInStock" HeaderText="UnitsInStock" SortExpression="UnitsInStock" />
                <asp:BoundField DataField="UnitsOnOrder" HeaderText="UnitsOnOrder" SortExpression="UnitsOnOrder" />
                <asp:CheckBoxField DataField="Discontinued" HeaderText="Discontinued" SortExpression="Discontinued" />
            </Fields>
           <FooterTemplate>
               this is footer
           </FooterTemplate>
       </asp:DetailsView>
       <asp:DataList ID="dlProducts" runat="server" DataSourceID="SqlDataSource">
           <ItemTemplate>
               <asp:Label ID="Label1" runat="server" Text='<%# Eval("ProductName") %>'></asp:Label>
           </ItemTemplate>
        </asp:DataList>
    </div> 
    </form>
</body>
</html>
